package com.ruoyi.service.company.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.enums.YesNoEnum;
import com.ruoyi.service.company.entity.UserCompanyEntity;
import com.ruoyi.service.company.mapper.UserCompanyMapper;
import com.ruoyi.service.company.service.UserCompanyService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 公司员工信息表 服务实现类
 * </p>
 *
 * @author Zane
 * @since 2025-10-22
 */
@Service
public class UserCompanyServiceImpl extends ServiceImpl<UserCompanyMapper, UserCompanyEntity>
    implements UserCompanyService {

  @Override
  public UserCompanyEntity getByUserId(Long userId) {
    return getOne(effectQuery().eq(UserCompanyEntity::getUserId, userId));
  }

  private LambdaQueryWrapper<UserCompanyEntity> effectQuery() {
    return new LambdaQueryWrapper<UserCompanyEntity>()
        .eq(UserCompanyEntity::getDelFlag, YesNoEnum.NO.getCode());
  }
}
